/*     */ package com.jcraft.jzlib;
/*     */ 
/*     */ import java.io.IOException;
/*     */ import java.io.OutputStream;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class ZOutputStream
/*     */   extends OutputStream
/*     */ {
/*  41 */   protected ZStream z = new ZStream();
/*  42 */   protected int bufsize = 512;
/*  43 */   protected int flush = 0;
/*  44 */   protected byte[] buf = new byte[this.bufsize]; protected byte[] buf1 = new byte[1];
/*     */   
/*     */   protected boolean compress;
/*     */   protected OutputStream out;
/*     */   
/*     */   public ZOutputStream(OutputStream out)
/*     */   {
/*  51 */     this.out = out;
/*  52 */     this.z.inflateInit();
/*  53 */     this.compress = false;
/*     */   }
/*     */   
/*     */   public ZOutputStream(OutputStream out, int level) {
/*  57 */     this(out, level, false);
/*     */   }
/*     */   
/*     */   public ZOutputStream(OutputStream out, int level, boolean nowrap)
/*     */   {
/*  62 */     this.out = out;
/*  63 */     this.z.deflateInit(level, nowrap);
/*  64 */     this.compress = true;
/*     */   }
/*     */   
/*     */   public void write(int b) throws IOException {
/*  68 */     this.buf1[0] = ((byte)b);
/*  69 */     write(this.buf1, 0, 1);
/*     */   }
/*     */   
/*     */   public void write(byte[] b, int off, int len) throws IOException {
/*  73 */     if (len == 0) {
/*  74 */       return;
/*     */     }
/*  76 */     this.z.next_in = b;
/*  77 */     this.z.next_in_index = off;
/*  78 */     this.z.avail_in = len;
/*     */     do {
/*  80 */       this.z.next_out = this.buf;
/*  81 */       this.z.next_out_index = 0;
/*  82 */       this.z.avail_out = this.bufsize;
/*  83 */       int err; int err; if (this.compress) {
/*  84 */         err = this.z.deflate(this.flush);
/*     */       } else
/*  86 */         err = this.z.inflate(this.flush);
/*  87 */       if (err != 0)
/*  88 */         throw new ZStreamException((this.compress ? "de" : "in") + 
/*  89 */           "flating: " + this.z.msg);
/*  90 */       this.out.write(this.buf, 0, this.bufsize - this.z.avail_out);
/*  91 */     } while ((this.z.avail_in > 0) || (this.z.avail_out == 0));
/*     */   }
/*     */   
/*     */   public int getFlushMode() {
/*  95 */     return this.flush;
/*     */   }
/*     */   
/*     */   public void setFlushMode(int flush) {
/*  99 */     this.flush = flush;
/*     */   }
/*     */   
/*     */   public void finish() throws IOException
/*     */   {
/*     */     do {
/* 105 */       this.z.next_out = this.buf;
/* 106 */       this.z.next_out_index = 0;
/* 107 */       this.z.avail_out = this.bufsize;
/* 108 */       int err; int err; if (this.compress) {
/* 109 */         err = this.z.deflate(4);
/*     */       } else {
/* 111 */         err = this.z.inflate(4);
/*     */       }
/* 113 */       if ((err != 1) && (err != 0))
/* 114 */         throw new ZStreamException((this.compress ? "de" : "in") + 
/* 115 */           "flating: " + this.z.msg);
/* 116 */       if (this.bufsize - this.z.avail_out > 0) {
/* 117 */         this.out.write(this.buf, 0, this.bufsize - this.z.avail_out);
/*     */       }
/* 119 */     } while ((this.z.avail_in > 0) || (this.z.avail_out == 0));
/* 120 */     flush();
/*     */   }
/*     */   
/*     */   public void end() {
/* 124 */     if (this.z == null)
/* 125 */       return;
/* 126 */     if (this.compress) {
/* 127 */       this.z.deflateEnd();
/*     */     } else {
/* 129 */       this.z.inflateEnd();
/*     */     }
/* 131 */     this.z.free();
/* 132 */     this.z = null;
/*     */   }
/*     */   
/*     */   /* Error */
/*     */   public void close()
/*     */     throws IOException
/*     */   {
/*     */     // Byte code:
/*     */     //   0: aload_0
/*     */     //   1: invokevirtual 144	com/jcraft/jzlib/ZOutputStream:finish	()V
/*     */     //   4: goto +26 -> 30
/*     */     //   7: astore_1
/*     */     //   8: goto +22 -> 30
/*     */     //   11: astore_2
/*     */     //   12: aload_0
/*     */     //   13: invokevirtual 146	com/jcraft/jzlib/ZOutputStream:end	()V
/*     */     //   16: aload_0
/*     */     //   17: getfield 36	com/jcraft/jzlib/ZOutputStream:out	Ljava/io/OutputStream;
/*     */     //   20: invokevirtual 148	java/io/OutputStream:close	()V
/*     */     //   23: aload_0
/*     */     //   24: aconst_null
/*     */     //   25: putfield 36	com/jcraft/jzlib/ZOutputStream:out	Ljava/io/OutputStream;
/*     */     //   28: aload_2
/*     */     //   29: athrow
/*     */     //   30: aload_0
/*     */     //   31: invokevirtual 146	com/jcraft/jzlib/ZOutputStream:end	()V
/*     */     //   34: aload_0
/*     */     //   35: getfield 36	com/jcraft/jzlib/ZOutputStream:out	Ljava/io/OutputStream;
/*     */     //   38: invokevirtual 148	java/io/OutputStream:close	()V
/*     */     //   41: aload_0
/*     */     //   42: aconst_null
/*     */     //   43: putfield 36	com/jcraft/jzlib/ZOutputStream:out	Ljava/io/OutputStream;
/*     */     //   46: return
/*     */     // Line number table:
/*     */     //   Java source line #138	-> byte code offset #0
/*     */     //   Java source line #139	-> byte code offset #4
/*     */     //   Java source line #141	-> byte code offset #8
/*     */     //   Java source line #142	-> byte code offset #12
/*     */     //   Java source line #143	-> byte code offset #16
/*     */     //   Java source line #144	-> byte code offset #23
/*     */     //   Java source line #145	-> byte code offset #28
/*     */     //   Java source line #142	-> byte code offset #30
/*     */     //   Java source line #143	-> byte code offset #34
/*     */     //   Java source line #144	-> byte code offset #41
/*     */     //   Java source line #146	-> byte code offset #46
/*     */     // Local variable table:
/*     */     //   start	length	slot	name	signature
/*     */     //   0	47	0	this	ZOutputStream
/*     */     //   7	1	1	localIOException	IOException
/*     */     //   11	18	2	localObject	Object
/*     */     // Exception table:
/*     */     //   from	to	target	type
/*     */     //   0	4	7	java/io/IOException
/*     */     //   0	11	11	finally
/*     */   }
/*     */   
/*     */   public long getTotalIn()
/*     */   {
/* 152 */     return this.z.total_in;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   public long getTotalOut()
/*     */   {
/* 159 */     return this.z.total_out;
/*     */   }
/*     */   
/*     */   public void flush() throws IOException {
/* 163 */     this.out.flush();
/*     */   }
/*     */ }


/* Location:              D:\Program Files\DBMS_20150813\jdbc\Dm7JdbcDriver17.jar!\com\jcraft\jzlib\ZOutputStream.class
 * Java compiler version: 2 (46.0)
 * JD-Core Version:       0.7.1
 */